home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / et / et3_0-a1.lha / et3 / src / TypeMatcher.h < prev    next >
C/C++ Source or Header  |  1992-06-23  |  2KB  |  61 lines

  1. #ifndef TypeMatcher_First
  2. #ifdef __GNUG__
  3. //pragma once
  4. #pragma interface
  5. #endif
  6. #define TypeMatcher_First
  7.  
  8. #include "Object.h"
  9. #include "Symbol.h"
  10.  
  11. class OrdCollection;
  12.  
  13. //---- file types --------------------------------------------------------------
  14.  
  15. extern const char *cMagic;  // magic cookie for ET++ generated files
  16.  
  17. extern Symbol
  18.     cDocTypeUndef,      // "UNDEF" document type
  19.     cDocTypeAscii,      // document type for ordinary ascii-files
  20.     cDocTypeET,         // ET++ file format
  21.     cDocTypeCPlusPlus,
  22.     cDocTypeC,
  23.     cDocTypeCHeader,
  24.     cDocTypeDirectory,  // System directory
  25.     cDocTypeSpecial;    // System special file
  26.  
  27. extern
  28. Symbol cDocCreatorUndef;  // Creator of document unknown
  29.  
  30. //---- TypeMatcher -------------------------------------------------------------
  31.  
  32. class TypeMatcher: public Object {
  33. public:
  34.     MetaDef(TypeMatcher);
  35.     TypeMatcher(Symbol t, char *ext, char *tag, bool ia, int prio= 1000);
  36.     ~TypeMatcher();
  37.  
  38.     static void AddMatcher(TypeMatcher *m);
  39.     static TypeMatcher *MatchByName(char *bp, int len);
  40.     static TypeMatcher *MatchByContents(char *name);
  41.  
  42. protected:
  43.     virtual bool MatchExtension(char *extension);
  44.     virtual bool MatchPathName(char *pathname, int len);
  45.     virtual bool MatchNameAndContents(char *pathname, char *buf, int len);
  46.     virtual bool MatchContents(char *buf, int len);
  47.     int Compare(Object *op);
  48.     
  49. public:
  50.     Symbol creator, type;
  51.     char *extension, *tag;
  52.     bool ascii, isCCode, isETFormat;
  53.     int priority;
  54.  
  55. private:
  56.     static OrdCollection *matchers;
  57.     static bool sorted;
  58. };
  59.  
  60. #endif
  61.